<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
<h:head>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>

<ui:param name="bean" value="#{gameParamConfigAction}" />
<h:body>
	<h:form id="fsearch">
		<p:growl id="growl" showDetail="true" sticky="true" />
		
		<p:panel id="panel0" header="添加查询" style="margin-bottom:10px;">
			<p:dataTable id="dlist0" var="l" value="#{bean.entity}" resizableColumns="true" paginator="false" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
				<p:column headerText="参数类型" styleClass="column">
					<p:selectOneMenu id="serverSel0" styleClass="queryServer" value="#{l.paramtype}">
						<f:selectItem itemLabel="请选择" itemValue="0" />
	         			<f:selectItems value="#{bean.queryGameParamTypeItmes}" />
        			</p:selectOneMenu>
				</p:column>
				<p:column headerText="参数ID" styleClass="column">
					<h:inputText value="#{l.paramid}" />
				</p:column>
				<p:column headerText="参数值" styleClass="column"  >
					<h:inputText value="#{l.paramname}" style="width:100%" /> 
				</p:column>
				<p:column headerText="排序" styleClass="column"  >
					<h:inputText value="#{l.seq}" style="width:100%" /> 
				</p:column>
				<p:column headerText="操作" styleClass="column">
					<p:commandButton value="查询" action="#{bean.search(l)}" update=":data" ajax="false" />
					|
					<p:commandButton value="添加" action="#{bean.add()}" update=":data" ajax="false" />
					|
					<p:commandButton value="上传" type="button" onclick="PF('dlg1').show();" />
				</p:column>
			</p:dataTable>
   		</p:panel>
	</h:form>
	<br />

	<h:form id="dform">
		<div class="data" id="data">
			<p:panel id="panel1" header="结果展示" style="margin-bottom:10px;">
				<p:dataTable id="dlist" var="l" value="#{bean.list}" resizableColumns="true" paginator="true" paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="15,30" rows="30" style="text-align:center;">
					<p:column headerText="参数类型" styleClass="column">
						<p:selectOneMenu id="serverSel" styleClass="queryServer" value="#{l.paramtype}" disabled="true">
		         			<f:selectItems value="#{bean.queryGameParamTypeItmes}" />
	        			</p:selectOneMenu>
					</p:column>
					<p:column headerText="参数ID" styleClass="column">
						<h:outputText value="#{bean.getParamIDStr(l)}" />
					</p:column>
					<p:column headerText="参数值" styleClass="column" >
						<h:inputText value="#{l.paramname}" style="width:100%" />
					</p:column>
					<p:column headerText="排序" styleClass="column"  >
						<h:inputText value="#{l.seq}" style="width:100%" /> 
					</p:column>
					<p:column headerText="操作" styleClass="column">
						<p:commandButton value="修改" action="#{bean.modify(l)}" update=":data" ajax="false" />
						<p:commandButton value="删除" action="#{bean.delete(l)}" update=":data" ajax="false" />
					</p:column>
				</p:dataTable>
	   		</p:panel>
   		</div>
	</h:form>
	
	<p:dialog header="文件上传" widgetVar="dlg1" modal="true" height="500" width="100%" position="300px">
    	<h:form enctype="multipart/form-data">
    		<h3>说明</h3>
    		<span style="color:red">1.上传的文件必须为Excel文件；</span><br />
    		<span style="color:red">2.文件内容不能有表头，必须直接是数据；</span><br />
    		<span style="color:red">3.数据共分为三列：类型（在系统配置-游戏参数类型配置中配置和查看），KEY，VALUE。其中类型列的数据必须一致。</span><br />
    		<span style="color:red">示例（物品类型配置）如下：</span><br />
    		<p:graphicImage url="/resources/images/excelsample.png"/>
			<p:separator />
    	
    		<h3>上传</h3>
    		<p:fileUpload fileUploadListener="#{bean.upload}" mode="advanced" allowTypes="/(\.|\/)(xls|xlsx|xlsm)$/" description="选择文件" label="选择" uploadLabel="上传" cancelLabel="取消" validatorMessage="格式错误." dragDropSupport="true" multiple="true" disabled="false"/>
	   		<p:separator />
	   		
	   		<h3>操作</h3>
	   		<span>请选择游戏参数类型：</span>
	   		<p:selectOneMenu styleClass="queryServer" value="#{bean.uploadparamtype}">
	   			<f:selectItem itemLabel="请选择" itemValue="0" />
     			<f:selectItems value="#{bean.queryGameParamTypeItmes}" />
   			</p:selectOneMenu>&#160;&#160;&#160;
	    	<p:commandButton value="生效" ajax="false" actionListener="#{bean.parseExcel}" />
		</h:form>
	</p:dialog>
</h:body>
</html>
